<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="../day1/first.jsp" onsubmit="return checkForm()">
    邮箱注册：<input type="text" name="user.name" onblur="checkEmail()"/><span></span><br/>
    密码：<input type="password" name="user.pwd" onblur="checkPwd()"/><span></span><br/>
    <input type="submit"/>
</form>
<script type="text/javascript" src="js1/jquery-1.11.1.js"></script>
<script type="text/javascript">
    function checkEmail() {
        v=$("input").val();
        console.log(v)
        if (v.indexOf("@.qq.com")!=-1){
            $("span:first").html("邮箱注册成功")
            return true;
        }else{
            $("span:first").html("格式不对注册失败")
            return  false;
        }
    }
    function checkPwd() {
        v=$(":password").val();
        console.log(v)
        if (isNaN(v)){
            $("span:last").html("密码注册成功")
            return true;
        }else{
            $("span:last").html("密码不能全为数字")
            return false;
        }
    }
    function checkForm() {
     return checkPwd()&&checkEmail();
    }
</script>

</body>
</html>